<style>
</style>
<template>
    <div>
        <Form ref="formData" :model="formData" :rules="formRules" :label-width="110">
            <Row>
                <!-- 差额/溢缴款金额 -->
                <Col :xs="24" :sm="12" :md="12" :lg="8" :xl="6" :xxl="6">
                    <FormItem label="差额" prop="amount">
                        <Row>
                            <Col span="17">
                                <Input type="text" v-model="formData.amount" disabled/>
                            </Col>
                            <Col span="6" offset="1">
                                <Button type="primary" :disabled="disabled" @click="openModal">详情</Button>
                            </Col>
                        </Row>
                    </FormItem>
                </Col>

                <!-- 无数据 -->
                <Col :xs="24" :sm="12" :md="12" :lg="8" :xl="6" :xxl="6">
                    <FormItem label="减免净额" prop="num">
                        <Input type="text" v-model="formData.netAmount" disabled/>
                    </FormItem>
                </Col>
                <!-- 无数据 -->
                <Col :xs="24" :sm="12" :md="12" :lg="8" :xl="6" :xxl="6">
                    <FormItem label="收款方式">
                        <Input type="text" v-model="formData.termsPayment" disabled/>
                    </FormItem>
                </Col>
                <!-- 支付至/支付人 -->
                <Col :xs="24" :sm="12" :md="12" :lg="8" :xl="6" :xxl="6">
                    <FormItem label="支付人" prop="payer">
                        <Input type="text" v-model="formData.payer" disabled/>
                    </FormItem>
                </Col>

                <Col :xs="24" :sm="12" :md="12" :lg="8" :xl="6" :xxl="6">
                    <FormItem label="支付时间" prop="paymentTime">
                        <DatePicker
                            type="date"
                            format="yyyy-MM-dd"
                            placeholder="请选择"
                            v-model="formData.paymentTime"
                            disabled
                        />
                    </FormItem>
                </Col>
                <!-- 退款银行/收款银行 -->
                <Col :xs="24" :sm="12" :md="12" :lg="8" :xl="6" :xxl="6">
                    <FormItem label="收款银行" prop="bankName">
                        <Select v-model="formData.bankName" clearable disabled>
                            <Option
                                v-for="(item,index) in dataDict.repaymentBankDict"
                                :key="index"
                                :value="item.value"
                            >{{item.title}}
                            </Option>
                        </Select>
                    </FormItem>
                </Col>
                <Col :xs="24" :sm="12" :md="12" :lg="8" :xl="6" :xxl="6">
                    <FormItem label="收入金额" prop="incomeAmount">
                        <Input type="text" v-model="formData.incomeAmount" disabled/>
                    </FormItem>
                </Col>
            </Row>
        </Form>
    </div>
</template>
<script>
    import {findcontractOverpayment} from "_p/basic/api/contract/contract-close/index";
    import {verifyErrorToView} from "_p/basic/assets/contract/js/utils";

    export default {
        props: {
            dataDict: {
                type: Object,
                required: true
            },
            isApprove: {
                type: Boolean,
                require: true
            },
            //对象参数包含：合同号码、角色类型
            Obj: {
                type: Object,
                required: true
            },
            pageParams: {
                type: Object,
                required: true
            }
        },
        data() {
            return {
                readOnly: false,
                formRules: {},
                formData: {}
            };
        },
        created() {
        },
        mounted() {
            this.init();
        },
        methods: {
            init() {
                if (this.Obj.process === "process") {
                    this.readOnly = this.Obj.process === "process" ? true : false;
                }
                this.getDetial(this.pageParams.contractNo);
            },
            getDetial(contractNo) {
                findcontractOverpayment(contractNo).then(res => {
                    this.loading = false;
                    if (res.code === "0000") {
                        this.formData = res.data;
                    }
                })
                    .catch(e => {
                        this.$Message.error("获取详情错误!");
                        console.log(e);
                    });
            },
            formValidate(funcName, data) {
                if (!funcName) return;

                this.$refs.formData.validate(valid => {
                    if (valid) {
                        let d = Object.assign({}, data, this.formData, this.Obj);

                        this.$emit(funcName, d);
                    } else {
                        this.$Message.error("验证不通过!");
                        this.$emit("closeSpin");
                        verifyErrorToView(this.$refs.formData.fields);
                    }
                });
            },
            openModal() {
                this.$emit("showModal", "differenceModal");
            }
        },
        computed: {}
    };
</script>
